#define TIPODADO double
#define TIPOVETOR vvector
#define TIPOFVETOR fvector
#define TIPOMATRIZ vmatrix

#include "tvector.cpp"

const vvector nullvector(unsigned n)
{
  vvector prov(n);
  for (unsigned i=0; i<prov.order(); i++) {
    prov.x[i] = (double)0.0;
  }
  prov.maketemp();
  return(prov);
}

/*###############################################################
##  VETORES DE COORDENADAS CARTESIANAS (VETORES ESPECIALIZADOS) # 
###############################################################*/

//=================================================================

Coord2::Coord2()
  :fvector(2)
{
}

Coord2::Coord2(const Coord2 &P)
  :fvector(P)
{
}

Coord2::Coord2(double X, double Y)
  :fvector(2)
{
  (*this)[0] = X;
  (*this)[1] = Y;
}

Coord2::Coord2(const vvector &P)
  :fvector(2)
{
  if (P.order() != 2) {
    matrix_error_int(MATRIX_WRONG_DIMENSION);
    (*this)[0] = NAN;
    (*this)[1] = NAN;
    return;
  }
  (*this)[0] = P[0];
  (*this)[1] = P[1];
}

//=================================================================

Coord3::Coord3()
  :fvector(3)
{
}

Coord3::Coord3(const Coord3 &P)
  :fvector(P)
{
}

Coord3::Coord3(double X, double Y, double Z)
  :fvector(3)
{
  (*this)[0] = X;
  (*this)[1] = Y;
  (*this)[2] = Z;
}

Coord3::Coord3(const vvector &P)
  :fvector(3)
{
  if (P.order() != 3) {
    matrix_error_int(MATRIX_WRONG_DIMENSION);
    (*this)[0] = NAN;
    (*this)[1] = NAN;
    (*this)[2] = NAN;
    return;
  }
  (*this)[0] = P[0];
  (*this)[1] = P[1];
  (*this)[2] = P[2];
}
